#ifndef __USR_MAIN_H
#define __USR_MAIN_H

/* ========================= 燂拷6 ========================*/
#include "common_api.h"
#include "luat_rtos.h"
#include "luat_mem.h"
#include "luat_debug.h"
#include "FreeRTOS.h"
#include "task.h"

#include "minmea.h"
#include "usr_board.h"
#include "usr_led.h"
#include <stdint.h>
#include <stdbool.h>

#include <RTE_Device.h>
#include "luat_gpio.h"//luat GPIO 库
#include "luat_adc.h"
#include "luat_pm.h"
#include "slpman.h"
#include "usr_mqtt.h"
#include "usr_lte.h"
#include "net_lwip.h"
#include "luat_mqtt.h"
#include "cJSON.h"
#include "usr_mqtt_msg.h"

#include "reset.h"
#include "usr_low_power.h"
#include "usr_event_handler.h"
//#include "agnss.h"
//#include "lbsloc.h"
#include "usr_gnss.h"
#include "usr_common.h"
#define USR_DEBUG 1
// #define GET_BIT(value,bit) ((value)&(1<<(bit)))    //读取指定位
// #define CPL_BIT(value,bit) ((value)^=(1<<(bit)))   //取反指定位

#define SET0_BIT(value,bit) ((value)&=~(1<<(bit))) //把某个位置0
#define SET1_BIT(value,bit) ((value)|= (1<<(bit))) //把某个位置1
#if USR_DEBUG
/* #define log_info            printf */
#define usr_log(x, ...) LUAT_DEBUG_PRINT("%s %d:" x, __FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define usr_log(...)
#endif

/**
 *  */

extern DEV_INFO_T *g_dev_info;
extern DEV_LTE_T g_dev_lte;
extern DEV_BSLOC_T g_dev_bsloc;
extern WORK_LED_CTRL_T gsm_work_led;
extern WORK_LED_CTRL_T gnss_work_led;
extern EBIKE_STATE_T g_ebike_status;
extern BEEP_PLAY_T beep_player;
/**
 * 订阅topic
 */
extern char sub_topic_control[MAX_TOPIC_LEN];
extern char sub_topic_config[MAX_TOPIC_LEN];
/**
 * 发布topic
 */
extern char pub_topic_online[MAX_TOPIC_LEN];
extern char pub_topic_offline[MAX_TOPIC_LEN];
extern char pub_topic_onreport[MAX_TOPIC_LEN];
extern char pub_topic_onchange[MAX_TOPIC_LEN];
extern char pub_topic_onalarm[MAX_TOPIC_LEN];
extern char pub_topic_ping[MAX_TOPIC_LEN];
extern char pub_topic_oncontrol[MAX_TOPIC_LEN];


/**
 * */
extern luat_rtos_task_handle gsm_led_task_handle;
extern luat_rtos_task_handle gnss_led_task_handle;
extern luat_rtos_task_handle gps_event_deal_task_handle;
extern luat_rtos_task_handle message_event_deal_task_handle;
extern luat_rtos_task_handle wheel_event_deal_task_handle;
extern luat_rtos_task_handle bsloc_task_handle;
extern luat_rtos_task_handle gnss_in_task_handle;
extern luat_rtos_task_handle publish_task_handle;
#endif /* __USR_MAIN_H */
